package com.wis.mapper;


import com.wis.entity.NoticeEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface NoticeMapper {
    //1 显示公告信息,分页查询
    @Select("select id,name,content,time from notice where state = 1 order by time desc limit #{page},#{limit}")
    List<NoticeEntity> showNotice(@Param("page")int page, @Param("limit")int limit);

    //2 根据id查询一条notice
    @Select("select * from notice where id = #{id} and state = 1")
    NoticeEntity showOneNotice(int id);

    // 3 统计notice数量
    @Select("select COUNT(1) from notice where state = 1 order by time desc")
    int showNoticeCount();
}


